package com.sale.salesystem.vo;

import lombok.Data;
import java.math.BigDecimal;
import java.util.List;

@Data
public class DashboardVO {
    // KPI数据
    private KpiDataVO kpiData;
    // 图表数据
    private ChartDataVO chartData;
    private Long dashboardId;
    private String dashboardName;
    private String type;
    private boolean hasPermission; // 当前用户是否有权限访问

    @Data
    public static class KpiDataVO {
        // 总销售额
        private BigDecimal totalSales;
        private Double salesWeekOnWeek;  // 周同比
        private Double salesDayOnDay;    // 日环比

        // 总利润
        private BigDecimal totalProfit;
        private Double profitWeekOnWeek;
        private Double profitDayOnDay;

        // 订单数量
        private Integer orderCount;
        private Double orderWeekOnWeek;
        private Double orderDayOnDay;

        // 销售量
        private Integer salesVolume;
        private Double volumeWeekOnWeek;
        private Double volumeDayOnDay;

        // 客户数量
        private Integer customerCount;
        private Double customerWeekOnWeek;
        private Double customerDayOnDay;

        // 新增：月度利润
        private BigDecimal monthlyProfit;
        private Double monthlyProfitWeekOnWeek;  // 新增：月度利润周同比
        private Double monthlyProfitDayOnDay;    // 新增：月度利润日环比
    }

    @Data
    public static class ChartDataVO {
        private List<String> months;          // 月份
        private List<BigDecimal> sales;       // 销售额趋势
        private List<BigDecimal> profits;     // 利润趋势
        private List<Integer> orders;         // 订单数量趋势
        private List<Integer> volumes;        // 销售量趋势
        private List<Integer> customers;      // 客户数量趋势
        private List<BigDecimal> totalSales;
        private List<BigDecimal> totalProfits;
        private List<BigDecimal> monthSales;
        private List<BigDecimal> monthProfits;
        private List<String> categories;
        private List<Integer> salesVolumes;
        private List<String> products;
        private List<BigDecimal> avgProfits;
        private List<BigDecimal> profitRates;
        private TrendVO trend;
        private List<DistributionVO> distribution;
    }

    @Data
    public static class TrendVO {
        private List<String> months;
        private List<BigDecimal> sales;
        private List<BigDecimal> profits;
        private List<Integer> orders;
        private List<Integer> volumes;
        private List<Integer> customers;
    }

    @Data
    public static class DistributionVO {
        private String name;
        private Integer value;
        private Double percent;
    }
}